#!/bin/bash

filename=$1
name=$(basename $filename | cut -f1 -d.)

$ADT_HOME/bin/pythonsh $ADT_HOME/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py -r ${name}.pdb -o ${name}_unbond.pdbqt
cp ${name}_unbond.pdbqt ${name}_bond.pdbqt

# ATOM type mapping:
# SA->X0
# OA->X1

sed -i -e '/SG.*CYS/s/SA$/X0/g' ${name}_bond.pdbqt
sed -i -e '/OG.*SER/s/OA$/X1/g' ${name}_bond.pdbqt
